package com.ebc.eservice.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ebc.eservice.pojo.EbcInteractClient;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ebc.eservice.pojo.EbcUserRole;
import com.ebc.eservice.vo.card.Client.ClientStat;
import com.ebc.eservice.vo.card.totalStat.TotalRespVo;
import com.ebc.eservice.vo.client.ClientListRespVo;
import com.ebc.eservice.vo.client.ClientQueryReqVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 客户互动记录表 Mapper 接口
 * </p>
 *
 * @author joey
 * @since 2022-09-17
 */
@Mapper
public interface InteractClientMapper extends BaseMapper<EbcInteractClient> {

    @Update("update ebc_interact_client set interact_num = interact_num + 1 where create_inter_time= #{createTime} and user_id= #{userId}")
    void updateInteractNum(String createTime,Integer userId);
    //获取名片客户总数
    @Select("select count(card_id = #{cardId}) as interacts from ebc_card_stat where card_id = #{cardId}")
    ClientStat getTotalClient(Integer cardId);

    //查询全部
    List<ClientStat> getAllClientStat(Integer cardId);

    //查询指定手机号 客户记录
    List<ClientStat> getClientStatByPhone(Integer cardId,String clientPhone);

    //admin获取客户列表
    List<ClientListRespVo> getAdminClientList(Integer companyId);

    List<ClientListRespVo> queryClientInfo(Integer companyId,Integer clientId,Integer staffId,String clientName);

    //获取6个月客户总数
    TotalRespVo getClientTotal(Integer companyId, Integer Month);


}
